Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shreya unit test permissions management #3044

Closed

Conversation

Shreyav2000
Copy link
Contributor

Description

This PR introduces unit tests for the PermissionsManagement component to enhance our code coverage and ensure that all new and existing functionalities are verified against regressions. The tests include checks for rendering components based on permissions, handling API calls and errors, and verifying the UI's responsiveness to state changes.
Fixes # (bug list priority low)

Related PRS (if any):

No related PRs.

Main changes explained:

  • Deleted the old test file that was incorrectly placed outside the standard test directory structure, which might have been causing confusion or errors during test runs.
  • Created a new test file inside the tests folder specifically for the PermissionsManagement component to adhere to project organization standards and improve maintainability.
  • Expanded the test suite to include tests for basic rendering, role-based button rendering, permission-based button visibility, dark mode style application, modal functionality, error handling, Redux action dispatching, pagination, and navigation between pages. These tests ensure comprehensive coverage of both the static and dynamic aspects of the component.

How to test:

  1. Check out into the current branch.
  2. Run npm install to ensure all dependencies are up to date, particularly if new testing libraries or updates are involved.
  3. Execute npm test to run the test suite specifically for the PermissionsManagement component.
  4. Verify that all tests pass without errors. Ensure that the newly added tests for pagination and navigation between pages are functioning as expected.
  5. Review the test output in the console for each test case to ensure comprehensive coverage and proper handling of different scenarios.

Screenshots or videos of changes:

Screenshot 2025-01-17 at 2 40 29 PM

Copy link

netlify bot commented Jan 17, 2025

Deploy Preview for highestgoodnetwork-dev failed.

Name Link
🔨 Latest commit 3a9b18a
🔍 Latest deploy log https://app.netlify.com/sites/highestgoodnetwork-dev/deploys/678aec83ca3b470008614bf8

@Maddila-Anjali
Copy link

Works as mentioned.
PR-3044

@Shreyav2000 Shreyav2000 force-pushed the shreya-unit-test-PermissionsManagement branch 2 times, most recently from 8ee1aa7 to 8bab40e Compare January 17, 2025 23:20
Copy link

@nikhilpittala16 nikhilpittala16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested the PR and test cases are failing. Add the command on how to test
image

@Shreyav2000 Shreyav2000 deleted the shreya-unit-test-PermissionsManagement branch January 25, 2025 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants